﻿Ext.define(Fsl.app.getAbsView('V01I006001X01'), {
    extend    : 'Ext.grid.Panel',
    alias     : Fsl.app.getAlias('V01I006001X01'),
    border    : true,
    modal     : true,
    height    : 310,
    width     : 390,
    viewConfig: {
        stripeRows    : true,
        forceFit      : true,
        emptyText     : 'No Records to display'
    },
	dockedItems: [{
        xtype : 'pagingtoolbar',
        store : Fsl.app.getRelStore('S01I006001'),
        dock  : 'bottom',
        displayInfo: true
    }],
    initComponent: function() {
        var me     = this,
		statusid   = 'win-statusbar-v01i006002';
        me.store   = Fsl.app.getRelStore('S01I006001');        
		me.tbar    = Fsl.tbar.getTB01I001(me.onCreate);
        me.bbar    = Fsl.bbar.getBB01I001(statusid); 
        this.columns = [{
            text            : 'SN',
            dataIndex       : 'id',
            width           : 40, 
            sortable        : false
        },{
            text            : 'Division',
            dataIndex       : 'divisionCode'
        },{
            text            : 'City-corporation',
            dataIndex       : 'nameEn',
            flex            : 1
        },{
            text            : 'সিটি কর্পোরেশন',
            dataIndex       : 'nameBn'
        },{
            menuDisabled    : true,
            id              : 'delete-v01i006002',
            xtype           : 'actioncolumn',            
            width           : 22,            
            items           : [{
                icon        : Fsl.route.getImage('DEL01005.png'),
                tooltip     : 'Delete This?',
                scope       : this,
                handler     : function(grid, rowIdx, colIdx) {
                    var record = grid.getStore().getAt(rowIdx);
                    var conId  = record.data.id
                    this.onDeleteClick(conId);
                }
            }]
        }]; 
        this.callParent(arguments);
    },
    
    onCreate: function(btn, e, eOpts){
        Fsl.app.getWidget('V01I006001X02').show();
    },
	
    onDeleteClick : function(conId) {
		var me     = this,
		model      = 'M01I006001',
		values     = {id : conId},
		status     = 'win-statusbar-v01i006002';
		Fsl.mbox.destroy(me, model, values, status);
    }
});